class Item < ActiveRecord::Base
	has_many :images, :dependent => :destroy
	has_one :user_vote
	has_attached_file   :picture, 
						:url  => "/assets/products/:id/:basename.:extension",
						:path => ":rails_root/public/assets/products/:id/:basename.:extension",
						:dependent => :destroy

  belongs_to :what
  belongs_to :user
  validates :title, :presence => true
  validates_attachment_size :picture, :less_than => 5.megabytes
  validates_attachment_content_type :picture, :content_type => ['image/jpeg', 'image/png']
  attr_accessible :description, :negociate, :price, :product, :sending, :title, :picture
  accepts_nested_attributes_for :user
end
